<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试按钮</title>
    <style>
        .button {
            position: relative;
            width: 150px;
            height: 60px;
            border-radius: 30px;
            background-color: #f5f5f5;
            color: #333;
            font-size: 18px;
            cursor: pointer;
            overflow: hidden;
        }

        .ripple {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: red;
            transform: scale(0);
            animation: ripple-effect 0.6s ease-out;
        }

        @keyframes ripple-effect {
            to {
                transform: scale(10);
                opacity: 0;
            }
        }
    </style>
</head>

<body>

    <button class="button" id="button">Click Me</button>

    <script>
        const button = document.getElementById('button');

        button.addEventListener('click', (event) => {
            const x = event.offsetX;
            const y = event.offsetY;

            const ripple = document.createElement('span');
            ripple.classList.add('ripple');
            ripple.style.left = `${x}px`;
            ripple.style.top = `${y}px`;

            button.appendChild(ripple);

            ripple.addEventListener('animationend', () => {
                ripple.remove();
            });
        });
    </script>

</body>

</html>